import request from "@/utils/request";

export default {
  //获取所有销售属性列表
  //GET /admin/product/baseSaleAttrList  getBaseSaleAttrList
  getBaseSaleAttrList() {
    return request.get('/admin/product/baseSaleAttrList')
  },
//DELETE /admin/product/deleteSpu/{spuId}   deleteSpu
  delete(spuId) {
    return request.delete(`/admin/product/deleteSpu/${spuId}`)
  },


//GET /admin/product/getSpuById/{spuId}   获取spu基本信息
  getSpu(spuId) {
    return request.get(`/admin/product/getSpuById/${spuId}`)
  },
//POST /admin/product/inner/findSpuInfoBySpuIdList   findSpuInfoBySpuIdList


//POST /admin/product/saveSpuInfo    保存saveSpuInfo

//修改POST /admin/product/updateSpuInfo  更改spu信息
  addOrUpdateSpuInfo(spuInfo) {
    // if (spuInfo.id){
    //   return request.post(' /admin/product/updateSpuInfo',spuInfo)
    // }else {
    //   return  request.post('/admin/product/saveSpuInfo',spuInfo)
    // }
    return request({
      url: `/admin/product/${spuInfo.id ? 'update' : 'save'}SpuInfo`,
      method: 'POST',
      data: spuInfo
    })
  },
//获取分页列表
//GET /admin/product/{page}/{limit}
  getPageSpuInfo(page, limit, category3Id) {
    return request.get(`/admin/product/${page}/${limit}`, {params: {category3Id}})
  }
}
